<template>
    <div class="main">
        <ul >
            <li class="media" v-for="item in list" :key="item.id" >
               <router-link :to="'/news_zx/'+item.id">
                    <div class="media-left">
                        <img class="media-object" :src="item.img_url" height="50" width="50">
                    </div>
                    <div class="media-body">
                        <h4 class="media-heading text">{{item.title}}</h4>
                        <p class="text">时间：{{item.add_time | dataFormat()}} 点击数：{{item.click}}</p>
                    </div>
                </router-link> 
            </li>
        </ul>
        
    </div>
</template>
<script>


export default {

    data(){
        return{
            list:[ ],
        }
    },
    methods:{
        get(){
            this.$http.get("api/getnewslist").then(
                result=>{
                    if(result.body.status==0){
                        this.list=result.body.message;
                        // console.log(this.list);
                    }else{
                        console.log("失败");
                    }
                }
            )
        }
    },
    created:function(){
        this.get();
    },
}
</script>
<style lang="scss" scoped>
.main{
    padding-top: 10px;
    padding-bottom: 50px;
    ul{
       padding: 0;
    }
    li{
      background: white;
      padding: 5px;
      margin-bottom: 5px;
    }
   .text{
        width: 70%;
        overflow: hidden;
        white-space: nowrap;
        text-overflow:ellipsis;
    }
    
    
    
}

</style>
